package core.rpt.model;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class DailySalesSummary {
	private String date;
	private BigDecimal totalSellPrice = new BigDecimal(0);
	private BigDecimal totalRealIncomeFreight = new BigDecimal(0);
	private BigDecimal lyTotalSellPrice = new BigDecimal(0);
	private BigDecimal lyTotalRealIncomeFreight = new BigDecimal(0);
	private Long totalPieces = 0L;
	private BigDecimal totalCostPrice = new BigDecimal(0);

	private Integer shopId;
	private String shopName;
	
	private List<DailySales> storeSales = new ArrayList<DailySales>();
	private Set<ShopDetail> stores = new HashSet<ShopDetail>(); 

	public List<DailySales> getStoreSales() {
		return storeSales;
	}
	public void setStoreSales(List<DailySales> storeSales) {
		this.storeSales = storeSales;
	}

	public void addStoreSales(DailySales sale) {
		this.date = sale.getDate();
		if (sale.getTotalSellPrice() != null) {
			this.totalSellPrice = this.totalSellPrice.add(sale.getTotalSellPrice());
		}
		if (sale.getTotalRealIncomeFreight() != null) {
			this.totalRealIncomeFreight = this.totalRealIncomeFreight.add(sale.getTotalRealIncomeFreight());
		}
		if (sale.getLyTotalSellPrice() != null) {
			this.lyTotalSellPrice = this.lyTotalSellPrice.add(sale.getLyTotalSellPrice());
		}
		if (sale.getLyTotalRealIncomeFreight() != null) {
			this.lyTotalRealIncomeFreight = this.lyTotalRealIncomeFreight.add(sale.getLyTotalRealIncomeFreight());
		}
		this.totalPieces += sale.getTotalPieces();
		if (sale.getTotalCostPrice() != null) {
			this.totalCostPrice = this.totalCostPrice.add(sale.getTotalCostPrice());
		}
		this.storeSales.add(sale);

		ShopDetail shop = new ShopDetail();
		shop.setAttributeId(sale.getAttributeId());
		shop.setShopId(sale.getShopId());
		shop.setShopName(sale.getShopName());
		this.stores.add(shop);
	}

	public Integer getShopId() {
		return shopId;
	}
	public void setShopId(Integer shopId) {
		this.shopId = shopId;
	}
	public String getShopName() {
		return shopName;
	}
	public void setShopName(String shopName) {
		this.shopName = shopName;
	}
	public String getDate() {
		return date;
	}
	public void setDate(String date) {
		this.date = date;
	}
	public BigDecimal getTotalSellPrice() {
		return totalSellPrice;
	}
	public void setTotalSellPrice(BigDecimal totalSellPrice) {
		this.totalSellPrice = totalSellPrice;
	}
	public BigDecimal getTotalRealIncomeFreight() {
		return totalRealIncomeFreight;
	}
	public void setTotalRealIncomeFreight(BigDecimal totalRealIncomeFreight) {
		this.totalRealIncomeFreight = totalRealIncomeFreight;
	}
	public Long getTotalPieces() {
		return totalPieces;
	}
	public void setTotalPieces(Long totalPieces) {
		this.totalPieces = totalPieces;
	}
	public BigDecimal getTotalCostPrice() {
		return totalCostPrice;
	}
	public void setTotalCostPrice(BigDecimal totalCostPrice) {
		this.totalCostPrice = totalCostPrice;
	}
	public Set<ShopDetail> getStores() {
		return stores;
	}
	public void setStores(Set<ShopDetail> stores) {
		this.stores = stores;
	}
	public BigDecimal getLyTotalSellPrice() {
		return lyTotalSellPrice;
	}
	public void setLyTotalSellPrice(BigDecimal lyTotalSellPrice) {
		this.lyTotalSellPrice = lyTotalSellPrice;
	}
	public BigDecimal getLyTotalRealIncomeFreight() {
		return lyTotalRealIncomeFreight;
	}
	public void setLyTotalRealIncomeFreight(BigDecimal lyTotalRealIncomeFreight) {
		this.lyTotalRealIncomeFreight = lyTotalRealIncomeFreight;
	}
}
